home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 682 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.0 KB  |  53 lines

  1. Path: chronicle.mti.sgi.com!austern
  2. From: smeyers@netcom.com (Scott Meyers)
  3. Newsgroups: comp.std.c++
  4. Subject: extern inlines
  5. Date: 10 Mar 1996 16:39:20 PST
  6. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <smeyersDo1L8o.99t@netcom.com>
  9. NNTP-Posting-Host: isolde.mti.sgi.com
  10. X-Original-Date: Sun, 10 Mar 1996 08:07:36 GMT
  11. Apparently-To: comp-std-c++@uunet.uu.net
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBVAwUBMUN2Q0y4NqrwXLNJAQECPgIAylje5jPdZdWNBRjQyTJvBkYlr2dZYbBR
  14.     CtGS0+n1RZOTGFomuyIly6ss70HMbJAZAqIceyyxOgSMo3UkxfzUww==
  15.     =17uF
  16. Originator: austern@isolde.mti.sgi.com
  17.  
  18. I'm a little confused about the meaning of extern inline functions.
  19. DWP 7.1.1.4 makes it clear that extern inline functions have external
  20. linkage, so I have two questions.
  21.  
  22. 1.  Suppose this definition occurs in header1.h:
  23.  
  24.       extern inline f() { cout << "Hello."; }
  25.     
  26.     Further suppose that header1.h is #included by file1.cpp, file2.cpp, and
  27.     file3.cpp and that, for whatever reason, f is NOT inlined.  Which object
  28.     file will contain the definition of f?  My understanding is that only
  29.     one of them will.
  30.  
  31. 2.  Now suppose there is a second header file header2.h, which contains
  32.     this definition:
  33.  
  34.       extern inline f() { cout << "Goodbye."; }  // note that this is
  35.                                                  // not the same as f above
  36.  
  37.     If I link together an object file containing the definition of f
  38.     from header1.h and another object file containing the definition of
  39.     f from header2.h, am I correct in assuming that the resulting
  40.     program violates the one definition rule and that this violation
  41.     need not be diagnosed?
  42.     
  43. Thanks,
  44.  
  45. Scott
  46. ---
  47. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
  48.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  49.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  50.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  51.   Comments? mailto:std-c++-request@ncar.ucar.edu 
  52. ]
  53.